﻿<c:BaseControl x:Class="personalplaner.gui.stamm.views.AddDiensteToLayout"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:bs="clr-namespace:personalplaner.business.stamm;assembly=personalplaner.business"
             xmlns:vm="clr-namespace:personalplaner.common.mvvm.factory;assembly=personalplaner.common"
             xmlns:fac="clr-namespace:personalplaner.gui.stamm.viewmodels.factories"
             vm:ViewModelLoader.FactoryType="{x:Type fac:AddDiensteToLayoutModelFactory}"
             xmlns:c="clr-namespace:personalplaner.common.controls;assembly=personalplaner.common"
             xmlns:conv="clr-namespace:personalplaner.common.converters;assembly=personalplaner.common"
             xmlns:p="clr-namespace:personalplaner.gui.Properties" Name="baseControl"
             Background="Transparent"
             Foreground="#E1000000">

    <Control.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <!--<ResourceDictionary Source="/personalplaner.common;component/resources/TabControlStyles.xaml"/>-->
                <ResourceDictionary Source="/personalplaner.common;component/resources/styles/WhiteStyleTemplates.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Control.Resources>
    
    <Grid>
        
        <Grid.Resources>
            <DataTemplate DataType="{x:Type bs:Dienst}">
                <Grid Margin="0,0,20,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="{Binding ID}" Grid.Column="0" Margin="5,0,5,0" Width="50"/>
                    <TextBlock Text="{Binding Name}" Grid.Column="1"/>
                </Grid>
            </DataTemplate>
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Grid Margin="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            
            <GroupBox Header="Team" BorderThickness="0">
                <Grid>
                    <ListBox Margin="20,0,20,0" BorderThickness="0,0,1,0"
                             ItemsSource="{Binding Abteilungen}"
                             SelectedItem="{Binding SelectedAbteilung}"
                             DisplayMemberPath="Name" MinWidth="150"/>
                </Grid>
            </GroupBox>
            
            <GroupBox Header="Nicht zugewiesene Dienste" Grid.Column="1" BorderThickness="0">
                <Grid>
                    <ListBox Margin="0,0,0,0" BorderThickness="0,0,1,0"
                             ItemsSource="{Binding NotAddedDienste}"
                             SelectedItem="{Binding SelectedNotAddedDienst}"/>
                </Grid>
            </GroupBox>

            <GroupBox Grid.Column="2" BorderThickness="0,0,1,0" Margin="10,30,25,0">
                <StackPanel Margin="0,0,20,0">
                    <TextBlock Text="Anzahl Einsätze"/>
                    <c:NumericTextBox Text="{FocusBinding Path=EinsaetzeProTag}"/>
                    <Button Style="{StaticResource BoarderedButtonStyle}" Margin="5,20,5,5" Command="{Binding AddToListCommand}" HorizontalAlignment="Center">
                        <Image Source="/personalplaner.gui;component/resources/images/Navigation Right.png" Style="{StaticResource ButtonImageStyle}" Height="16" Margin="2"/>
                    </Button>
                    <Button Style="{StaticResource BoarderedButtonStyle}" Margin="5,0,5,5" Command="{Binding RemoveFromListCommand}" HorizontalAlignment="Center">
                        <Image Source="/personalplaner.gui;component/resources/images/Navigation Left.png" Style="{StaticResource ButtonImageStyle}" Height="16" Margin="2"/>
                    </Button>
                </StackPanel>
            </GroupBox>

            <GroupBox Header="Zugewiesene Dienste" Grid.Column="3" BorderThickness="0,0,0,0" >
                <Grid>
                    <ListBox Margin="0,0,20,0" BorderThickness="0,0,1,0"
                             ItemsSource="{Binding AddedDienste}"
                             SelectedItem="{Binding SelectedAddedDienst}"/>
                </Grid>
            </GroupBox>
            
        </Grid>

        <StackPanel Grid.Row="1" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,20,40,20">
            <Button MinWidth="60" Margin="5" Command="{Binding SaveCommand}">
                <TextBlock Text="{x:Static p:Resources.Save}"/>
            </Button>
            <Button MinWidth="60" Margin="5" IsDefault="True" 
                    Command="{Binding OkCommand}">
                <TextBlock Text="{x:Static p:Resources.Ok}"/>
            </Button>
            <Button MinWidth="60" Margin="5" IsCancel="True" 
                    Command="{Binding CancelCommand}">
                <TextBlock Text="{x:Static p:Resources.Cancel}"/>
            </Button>
        </StackPanel>
    </Grid>
</c:BaseControl>
